using System.Collections.Generic;
using UnityEngine;

public class Magnet : MonoBehaviour
{
	public CircleCollider2D cCollider;

	public Rigidbody2D cRigidbody;

	private List<Collectible> collectibles;

	public List<Collectible> Collectibles
	{
		get
		{
			return collectibles;
		}
	}

	private void Awake()
	{
		collectibles = new List<Collectible>();
	}

	private void OnEnable()
	{
		collectibles.Clear();
	}

	private void OnDisable()
	{
		collectibles.Clear();
	}

	public void EnablePhysics()
	{
		cRigidbody.simulated = true;
		cCollider.enabled = true;
	}

	public void DisablePhysics()
	{
		cRigidbody.simulated = false;
		cCollider.enabled = false;
	}

	private void OnTriggerEnter2D(Collider2D col)
	{
		if (col.CompareTag(Values.Instance.CollectibleTag))
		{
			collectibles.Add(col.GetComponent<Collectible>());
		}
	}
}
